This readme gives context and guidance for the replication data and code for the study "A Crisis of Political Trust? Global trends in institutional trust from 1958 to 2019", forthcoming in the British Journal of Political Science.

The study is based on secondary data from 50 separate survey projects which have fielded measures of trust in one of six institutions (government, parliament, political parties, the civil service, the legal system, and the police).

We do not make the individual-level data for our analysis available as the rights belong to the proprietors of each survey project. In most cases, these are publicly available to access online, but in some cases the proprietors require log-in to their web portals, agreement of terms and services and/or approved applications for access. A list of all survey projects included in our study can be found in Table 1 in the main text of the paper.

However, we share for replication the aggregated version of the individual-level data, which is aggregated at the country-year-study level (where "study" is short-hand for each survey project in question). This version of the dataset is used in almost all of the analysis presented in the paper (the exception is the part of the sensitivity analysis which uses multi-level regression models on the individual-level data).

This aggregated dataset can be found in the files named "Trust_trends_rep", included both as .dta and .csv files in the replication folder.

The source variables for each question were dichotomized according to the scheme laid out in the paper and Appendix B in the Supplementary Material (SM). In short, responses indicating trust were given the value 1 and those indicating lack of trust were given the value 0. Refusals and "don't know" responses were made missing in all cases. Where "neutral" responses and scalar mid-points were provided, these were made missing in almost all cases, with a few exceptions which are detailed in Appendix B in the SM.

Basic sampling and demographic weights were applied in the aggregation in most cases where they are available, as laid out in more detail in Appendix H in the SM. Where the source data provides information for the year in which each interview was conducted, the year of the survey in that country-year-study observation is coded as the year in which a majority of respondents in that survey were interviewed.

We keep observations from surveys fielded in independent countries (including / as well as Taiwan, Palestine and Hong Kong). We merge surveys conducted separately in East and West Germany, weighting them approximately according to the respective population of each part. We only include countries which includes any of the trust measures in more than one year.

We provide .do-files (for use in Stata) as well as .R files and .STAN files (for use in R): Stata was used for most of the data handling, but R was used for the analysis and for graphs, and the STAN code was used through R for the main analyses.

The following lists explain which files are to be used for which purpose.
Stata do-files for preparing the data:
*datainfo_rep.do is used to get the information presented in Appendix B in the SM: about the dataset and the equivalence of different approaches to dichotomization where mid-point responses are available
*stimsons_rep.do is used to prepare the data for analysis with Stimson's dyad-ratios algorithm
*trends_bayes_rep.do is used to prepare the data for the main analysis of the study, the Bayesian dynamic latent trait models

R files for main analyses:
*Files with the suffixes "trends_rep.R" are used to run the main analysis for latent trends in trust in each institution by country
*Files with the suffixes "regions_rep.R" are used to run the main analysis for latent trends in trust in each institution by world region
*In the above files, "parl" refers to trust in parliament, "gov" refers to government, "polpar" refers to political parties, "civil" refers to the civil service, "leg" refers the legal system, and "police" refers to the police
*The file "trends_all_rep.R" is used to run the main analysis for latent trends in trust in each institution globally

R files for sensitivity analysis and descriptive graphs:
*trends_stimsons_rep.R is used to run Stimson's algorithm
*trends_regs_rep.R is used to run the multi-level regression models (MLMs)
*trends_des_rep.R is used to obtain decsriptive graphs for trends in each type of trust by (major) survey source, as presented in the 

STAN files for main analysis (all of these are run automatically by the above R code):
*stan_mod6_v6_rep.STAN is used to run the Bayesian dynamic latent trait models by country
*stan_mod6_v6_reg_rep.STAN is used to run the Bayesian dynamic latent trait models by world region
*stan_mod6_v6_all_rep.STAN is used to run the Bayesian dynamic latent trait models globally
